<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="<s:url value="/assets/web/css/base.css"></s:url>"><!-- 基本框css -->
    <link rel="stylesheet" href="<s:url value="/assets/web/css/login/bootstrap.min.css?v=3.3.6"></s:url>">
    <link rel="stylesheet" href="<s:url value="/assets/web/css/base_nav.css"></s:url>">
    <link rel="stylesheet" href="<s:url value="/assets/css/jquery-ui.css"></s:url>"/>
    <link rel="stylesheet" href="<s:url value="/assets/css/datepicker.css"></s:url>"/>
    <title>在建项目进度填报</title>
    <style>
        .container {
            width: auto;
        }

        .av {
            background-color: #fff;
            height: auto !important;
        }

        .pType {
            background: #fff;
            padding: 5px 0px 5px 8px;
            border-radius: 6px;
            margin: 3px 0px 3px 0px;
        }
    </style>
</head>

<body class="bgcolor">
<%@ include file="/WEB-INF/views/modules/commons/nav.jsp" %>
<%@ include file="/WEB-INF/views/modules/commons/menu.jsp" %>

<table></table>
<!-- 窗口显示区 -->
<div class="av row J_mainContent" id="content-main">
    <div class="container">
        <h3>开工项目进度</h3>
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog" style="width: 1000px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            填写进度报告
                        </h4>
                    </div>
                    <div class="modal-body">
                        <form id="themeForm" method="post" action="" class="form-horizontal">
                            <input type="text" id="projectId_id"
                                   class="form-control date-picker1 hidden" value="${newProject.sysId}"
                                   name="projectId"/>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="dataTime_id">数据时间(默认当月)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="dataTime_id" value="${currentMonth}"
                                               class="form-control date-picker1" autocomplete='off' name="dataTime"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="yearTarget_id">本年工作目标</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="yearTarget_id"
                                               class="form-control" autocomplete='off' name="yearTarget"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="yearPlanInv_id">年计划投资(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="yearPlanInv_id" required
                                               class="form-control" autocomplete='off' name="yearPlanInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>

                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="thisTimeFinishInv_id">本次已完成投资(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="thisTimeFinishInv_id" required
                                               class="form-control" autocomplete='off' name="thisTimeFinishInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label"
                                           for="thisMonthInPlaceInv_id">本月到位资金(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="thisMonthInPlaceInv_id" required
                                               class="form-control" autocomplete='off' name="thisMonthInPlaceInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label"
                                           for="thisYearCumulativeInv_id">本年累计投资(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="thisYearCumulativeInv_id" required
                                               class="form-control" autocomplete='off' name="thisYearCumulativeInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="thisYearCumulativeInPlaceInv_id">本年累计到位资金(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="thisYearCumulativeInPlaceInv_id" required
                                               class="form-control" autocomplete='off'
                                               name="thisYearCumulativeInPlaceInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="cumulativeInv_id">项目累计投资(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="cumulativeInv_id" class="form-control" required
                                               autocomplete='off' name="cumulativeInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label"
                                           for="cumulativeInPlaceInv_id">项目累计到位资金(万元)</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="cumulativeInPlaceInv_id" class="form-control" required
                                               autocomplete='off' name="cumulativeInPlaceInv"
                                               onkeyup="javascript:CheckInputIntFloat(this);"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="startState_id">开工状态</label>
                                    <div class="col-lg-7">
                                        <select class="form-control" id="startState_id" name="startState">
                                            <option value="1">已开工</option>
                                            <option value="0">未开工</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="completedState_id">竣工状态</label>
                                    <div class="col-lg-7">
                                        <select class="form-control" id="completedState_id" name="completedState">
                                            <option value="0">未竣工</option>
                                            <option value="1">已竣工</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="planStartDate_id">计划开工日期</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="planStartDate_id" required
                                               class="form-control date-picker" autocomplete='off'
                                               name="planStartDate"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="planCompletedDate_id">计划竣工日期</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="planCompletedDate_id" required
                                               class="form-control date-picker" autocomplete='off'
                                               name="planCompletedDate"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="factStartDate_id">实际开工日期</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="factStartDate_id" required
                                               class="form-control date-picker" autocomplete='off'
                                               name="factStartDate"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="factCompletedDate_id">实际竣工日期</label>
                                    <div class="col-lg-7">
                                        <input type="text" id="factCompletedDate_id" required
                                               class="form-control date-picker" autocomplete='off'
                                               name="factCompletedDate"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="progress_id">实际形象进度</label>
                                    <div class="col-lg-7">
                                        <textarea rows="3" id="progress_id" required
                                                  class="form-control" autocomplete='off' name="progress"></textarea>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-lg-5 control-label" for="problem_id">存在问题</label>
                                    <div class="col-lg-7">
                                        <textarea rows="3" class="form-control" required
                                                  id="problem_id" autocomplete='off' name="problem"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" id="close-modal-progress" class="btn btn-default"
                                        data-dismiss="modal">关闭
                                </button>
                                <button type="submit" class="btn btn-primary" id="addProgress">添加进度</button>
                            </div>
                        </form>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </div>
    <div class="">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="hero-unit well" style="padding: 10px;">
                        <div class="row clearfix">
                            <div class="col-md-6 column">
                                <p class="pType">
                                    项目名称 : ${newProject.name}
                                </p>
                            </div>
                            <div class="col-md-6 column">
                                <p class="pType">
                                    项目状态 : ${projectList.status == "1" ? "待审批部门确认节点" :
                                        projectList.status == "2" ? "管理员未审核":
                                                projectList.status == "3" ? "项目进行中":
                                                        projectList.status == "4" ? "已完成":
                                                                projectList.status == "5" ? "审核不通过，请重新配置节点信息": "项目已暂停"}
                                </p>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-6 column">
                                <p class="pType">
                                    责任单位 : ${newProject.resDept}
                                </p>
                            </div>
                            <div class="col-md-6 column">
                                <p class="pType">
                                    项目联系人 : ${newProject.contactName}
                                </p>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-6 column">
                                <p class="pType">
                                    分管领导 : ${newProject.resUser}
                                </p>
                            </div>
                            <div class="col-md-6 column">
                                <p class="pType">
                                    征迁实施单位 :
                                    ${newProject.occupyDept}
                                    <c:if test="${newProject.occupyDept == null}">
                                        无
                                    </c:if>
                                </p>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-6 column">
                                <p class="pType">
                                    征迁责任人 :
                                    ${newProject.occupyResUser}
                                    <c:if test="${newProject.occupyResUser == null}">
                                        无
                                    </c:if>
                                </p>
                            </div>
                            <div class="col-md-6 column">
                                <p class="pType">
                                    征迁经办人 :
                                    ${newProject.occupyOperateUser}
                                    <c:if test="${newProject.occupyOperateUser == null}">
                                        无
                                    </c:if>
                                </p>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-6 column">
                                <p class="pType">
                                    计划投资总额(万元) : ${newProject.money}
                                </p>
                            </div>
                            <div class="col-md-6 column">
                                <p class="pType">
                                    初步选址 : ${newProject.address}
                                </p>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <p class="pType">
                                    建设内容 : ${newProject.describes}
                                </p>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-6 column">
                                <p class="pType">
                                    行业类型
                                    : ${newProject.natureType == '0' ? '政府投资类' : projectList.natureType == '1' ? '企业投资类' : '土地收储类'}
                                </p>
                            </div>
                            <div class="col-md-6 column">
                                <button class="btn btn-primary btn-sm" style="margin: 3px 0px;" data-toggle="modal" data-target="#myModal">
                                    填报进度
                                </button>
                            </div>
                        </div>

                    </div>
                    <div class="tabbable" id="tabs-764270">
                        <ul class="nav nav-tabs tabs_active">

                            <c:forEach var="list" items="${list}">
                                <li>
                                    <a href="#panel-${list.sysId}" data-toggle="tab">${list.dataTime}</a>
                                </li>
                            </c:forEach>
                        </ul>
                        <div class="tab-content">
                            <c:forEach var="list" items="${list}">
                                <div class="tab-pane" id="panel-${list.sysId}">
                                    <div class="container">
                                        <div class="row clearfix">
                                            <div class="col-md-12 column">
                                                <table class="table table-bordered">
                                                    <thead>
                                                    <tr>
                                                        <th>
                                                            编号
                                                        </th>
                                                        <th>
                                                            项目
                                                        </th>
                                                        <th>
                                                            内容
                                                        </th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr>
                                                        <td>
                                                            1
                                                        </td>
                                                        <td>
                                                            本年工作目标
                                                        </td>
                                                        <td>
                                                                ${list.yearTarget}
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            2
                                                        </td>
                                                        <td>
                                                            年计划投资
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number" value="${list.yearPlanInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            3
                                                        </td>
                                                        <td>
                                                            本次已完成投资
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number"
                                                                              value="${list.thisTimeFinishInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            4
                                                        </td>
                                                        <td>
                                                            本月到位资金
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number"
                                                                              value="${list.thisMonthInPlaceInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            5
                                                        </td>
                                                        <td>
                                                            本年累计投资
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number"
                                                                              value="${list.thisYearCumulativeInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            6
                                                        </td>
                                                        <td>
                                                            本年累计到位资金
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number"
                                                                              value="${list.thisYearCumulativeInPlaceInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            7
                                                        </td>
                                                        <td>
                                                            项目累计投资
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number"
                                                                              value="${list.cumulativeInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            8
                                                        </td>
                                                        <td>
                                                            项目累计到位资金
                                                        </td>
                                                        <td>
                                                            <fmt:formatNumber type="number"
                                                                              value="${list.cumulativeInPlaceInv}"
                                                                              maxFractionDigits="2"/>万元
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            9
                                                        </td>
                                                        <td>
                                                            开工状态
                                                        </td>
                                                        <td>
                                                            <c:if test="${list.startState == '1'}">
                                                                已开工
                                                            </c:if>
                                                            <c:if test="${list.startState == '0'}">
                                                                未开工
                                                            </c:if>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            10
                                                        </td>
                                                        <td>
                                                            竣工状态
                                                        </td>
                                                        <td>
                                                            <c:if test="${list.completedState == '1'}">
                                                                已竣工
                                                            </c:if>
                                                            <c:if test="${list.completedState == '0'}">
                                                                未竣工
                                                            </c:if>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            11
                                                        </td>
                                                        <td>
                                                            计划开工日期
                                                        </td>
                                                        <td>
                                                                ${list.planStartDate}
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            12
                                                        </td>
                                                        <td>
                                                            计划竣工日期
                                                        </td>
                                                        <td>
                                                                ${list.planCompletedDate}
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            13
                                                        </td>
                                                        <td>
                                                            实际开工日期
                                                        </td>
                                                        <td>
                                                                ${list.factStartDate}
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            14
                                                        </td>
                                                        <td>
                                                            实际竣工日期
                                                        </td>
                                                        <td>
                                                                ${list.factCompletedDate}
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            15
                                                        </td>
                                                        <td>
                                                            实际形象进度
                                                        </td>
                                                        <td>
                                                                ${list.progress}
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            16
                                                        </td>
                                                        <td>
                                                            存在问题
                                                        </td>
                                                        <td>
                                                                ${list.problem}
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </c:forEach>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%--修改模态框--%>

<script src="<s:url value="/assets/web/js/jquery.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/bootstrap.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/common/bootstrapvalidator/dist/js/bootstrapValidator.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/baseAPI.js"></s:url>"></script>
<script src="<s:url value="/assets/js/date-time/bootstrap-datepicker.js"></s:url>"></script>
<script>

    $(function () {
        //给第一条加标签
        $(".tabs_active").each(function () {
            $(this).find("li").first().addClass("active");
        });

        $(".tab-content").each(function () {
            $(this).find(".tab-pane").first().addClass("active");
        });

        //选择年月日
        $('.date-picker').datepicker({
            inline: true,
            format: "yyyymmdd",
            autoclose: true,
            todayHighlight: true,
            language: 'cn'
        });
        //只选择年月
        $('.date-picker1').datepicker({
            format: 'yyyy-mm',
            autoclose: true,
            startView: 1,
            minViewMode: 1,
            maxViewMode: 1,
            language: 'cn'
        });

        //提交
        $("#addProgress").click(function () {
            //表单序列化为json
            var para = $("#themeForm").serializeObject();
            para = JSON.stringify(para);
            $.ajax({
                type: "post",
                url: "/web/buildProject/addBuildRecord",
                dataType: "json",
                contentType: 'application/json;charset=utf-8',
                data: para,
                success: function (res) {
                    if (res.code == '200') {
                        if (res.data == '0') {
                            alert(res.message);
                        } else {
                            alert(res.message);
                            location.reload();
                        }
                    } else {
                        alert(res.message);
                    }
                }
            })
        })
    });

    //表单序列化-方法
    $.fn.serializeObject = function () {
        var o = {};
        var a = this.serializeArray();
        $.each(a, function () {
            if (o[this.name] !== undefined) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };

    function CheckInputIntFloat(oInput) {
        if ('' != oInput.value.replace(/\d{1,}\.{0,1}\d{0,}/, '')) {
            oInput.value = oInput.value.match(/\d{1,}\.{0,1}\d{0,}/) == null ? '' : oInput.value.match(/\d{1,}\.{0,1}\d{0,}/);
        }
    }
</script>
</body>
</html>